home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / tex / macros / eepic / grafig.shar / object.h < prev    next >
Text File  |  1993-01-12  |  5KB  |  225 lines

  1. /* 
  2.  *    FIG : Facility for Interactive Generation of figures
  3.  *
  4.  *    (c) copy right 1985 by Supoj Sutanthavibul (supoj@sally.utexas.edu)
  5.  *      January 1985.
  6.  *    1st revision : Aug 1985.
  7.  *    2nd revision : Feb 1988.
  8.  *
  9.  *    %W%    %G%
  10. */
  11. #define                    DEFAULT            (-1)
  12.  
  13. typedef        struct f_pattern {
  14.             int            w, h;
  15.             int            *p;
  16.             }
  17.         F_pattern;
  18.  
  19. typedef        struct f_pen {
  20.             int            x, y;
  21.             int            *p;
  22.             }
  23.         F_pen;
  24.  
  25. typedef        struct f_point {
  26.             int            x, y;
  27.             struct f_point        *next;
  28.             }
  29.         F_point;
  30.  
  31. typedef        struct f_pos {
  32.             int            x, y;
  33.             }
  34.         F_pos;
  35.  
  36. typedef        struct f_arrow {
  37.             int            type;
  38.             int            style;
  39.             double            thickness;
  40.             double            wid;
  41.             double            ht;
  42.             }
  43.         F_arrow;
  44.  
  45. typedef        struct f_ellipse {
  46.             int            type;
  47. #define                    T_ELLIPSE_BY_RAD    1
  48. #define                    T_ELLIPSE_BY_DIA    2
  49. #define                    T_CIRCLE_BY_RAD        3
  50. #define                    T_CIRCLE_BY_DIA        4
  51.             int            style;
  52.             int            thickness;
  53.             int            color;
  54. #define                    BLACK            0
  55.             int            depth;
  56.             int            direction;
  57.             double            style_val;
  58.             double            angle;
  59.             struct f_pen        *pen;
  60.             struct f_pattern    *area_fill;
  61. #define                           UNFILLED    (F_pattern *)0
  62. #define                           BLACK_FILL    (F_pattern *)1
  63. #define                           DARK_GRAY_FILL    (F_pattern *)2
  64. #define                           MED_GRAY_FILL    (F_pattern *)3
  65. #define                           LIGHT_GRAY_FILL    (F_pattern *)4
  66. #define                           WHITE_FILL    (F_pattern *)4
  67.             struct f_pos        center;
  68.             struct f_pos        radiuses;
  69.             struct f_pos        start;
  70.             struct f_pos        end;
  71.             struct f_ellipse    *next;
  72.             }
  73.         F_ellipse;
  74.  
  75. typedef        struct f_arc {
  76.             int            type;
  77. #define                    T_3_POINTS_ARC        1
  78.             int            style;
  79.             int            thickness;
  80.             int            color;
  81.             int            depth;
  82.             struct f_pen        *pen;
  83.             struct f_pattern    *area_fill;
  84.             double            style_val;
  85.             int            direction;
  86.             struct f_arrow        *for_arrow;
  87.             struct f_arrow        *back_arrow;
  88.             struct {double x, y;}    center;
  89.             struct f_pos        point[3];
  90.             struct f_arc        *next;
  91.             }
  92.         F_arc;
  93.  
  94. typedef        struct f_line {
  95.             int            type;
  96. #define                    T_POLYLINE    1
  97. #define                    T_BOX        2
  98. #define                    T_POLYGON    3
  99.             int            style;
  100.             int            thickness;
  101.             int            color;
  102.             int            depth;
  103.             double            style_val;
  104.             struct f_pen        *pen;
  105.             struct f_pattern    *area_fill;
  106.             struct f_arrow        *for_arrow;
  107.             struct f_arrow        *back_arrow;
  108.             struct f_point        *points;
  109.             struct f_line        *next;
  110.             }
  111.         F_line;
  112.  
  113. typedef        struct f_text {
  114.             int            type;
  115. #define                    T_LEFT_JUSTIFIED    0
  116. #define                    T_CENTER_JUSTIFIED    1
  117. #define                    T_RIGHT_JUSTIFIED    2
  118.             int            font;
  119. #define                    DEFAULT_FONT        0
  120. #define                    ROMAN_FONT        1
  121. #define                    BOLD_FONT        2
  122. #define                    ITALIC_FONT        3
  123. #define                    MODERN_FONT        4
  124. #define                    TYPEWRITER_FONT        5
  125.             int            size;    /* point size */
  126.             int            color;
  127.             int            depth;
  128.             double            angle;    /* in radian */
  129.             int            style;
  130. #define                    PLAIN        1
  131. #define                    ITALIC        2
  132. #define                    BOLD        4
  133. #define                    OUTLINE        8
  134. #define                    SHADOW        16
  135.             int            height;    /* pixels */
  136.             int            length;    /* pixels */
  137.             int            base_x;
  138.             int            base_y;
  139.             struct f_pen        *pen;
  140.             char            *cstring;
  141.             struct f_text        *next;
  142.             }
  143.         F_text;
  144.  
  145. typedef        struct f_control {
  146.             double            lx, ly, rx, ry;
  147.             struct f_control    *next;
  148.             }
  149.         F_control;
  150.  
  151. #define        int_spline(s)        (s->type & 0x2)
  152. #define        normal_spline(s)    (!(s->type & 0x2))
  153. #define        closed_spline(s)    (s->type & 0x1)
  154. #define        open_spline(s)        (!(s->type & 0x1))
  155.  
  156. typedef        struct f_spline {
  157.             int            type;
  158. #define                    T_OPEN_NORMAL        0
  159. #define                    T_CLOSED_NORMAL        1
  160. #define                    T_OPEN_INTERPOLATED    2
  161. #define                    T_CLOSED_INTERPOLATED    3
  162.             int            style;
  163.             int            thickness;
  164.             int            color;
  165.             int            depth;
  166.             double            style_val;
  167.             struct f_pen        *pen;
  168.             struct f_pattern    *area_fill;
  169.             struct f_arrow        *for_arrow;
  170.             struct f_arrow        *back_arrow;
  171.             /*
  172.             For T_OPEN_NORMAL and T_CLOSED_NORMAL points
  173.             are control points while they are knots for
  174.             T_OPEN_INTERPOLATED and T_CLOSED_INTERPOLTED
  175.             whose control points are stored in controls.
  176.             */
  177.             struct f_point        *points;
  178.             struct f_control    *controls;
  179.             struct f_spline        *next;
  180.             }
  181.         F_spline;
  182.  
  183. typedef        struct f_compound {
  184.             struct f_pos        nwcorner;
  185.             struct f_pos        secorner;
  186.             struct f_line        *lines;
  187.             struct f_ellipse    *ellipses;
  188.             struct f_spline        *splines;
  189.             struct f_text        *texts;
  190.             struct f_arc        *arcs;
  191.             struct f_compound    *compounds;
  192.             struct f_compound    *next;
  193.             }
  194.         F_compound;
  195.  
  196. #define        ARROW_SIZE        sizeof(struct f_arrow)
  197. #define        POINT_SIZE        sizeof(struct f_point)
  198. #define        CONTROL_SIZE        sizeof(struct f_control)
  199. #define        ELLOBJ_SIZE        sizeof(struct f_ellipse)
  200. #define        ARCOBJ_SIZE        sizeof(struct f_arc)
  201. #define        LINOBJ_SIZE        sizeof(struct f_line)
  202. #define        TEXOBJ_SIZE        sizeof(struct f_text)
  203. #define        SPLOBJ_SIZE        sizeof(struct f_spline)
  204. #define        COMOBJ_SIZE        sizeof(struct f_compound)
  205.  
  206. /**********************  object codes  **********************/
  207.  
  208. #define        O_ELLIPSE        1
  209. #define        O_POLYLINE        2
  210. #define        O_SPLINE        3
  211. #define        O_TEXT            4
  212. #define        O_ARC            5
  213. #define        O_COMPOUND        6
  214. #define        O_END_COMPOUND        (-O_COMPOUND)
  215. #define        O_ALL_OBJECT        99
  216.  
  217. /************  object styles (except for f_text)  ************/
  218.  
  219. #define        SOLID_LINE        0
  220. #define        DASH_LINE        1
  221. #define        DOTTED_LINE        2
  222.  
  223. #define        CLOSED_PATH        0
  224. #define        OPEN_PATH        1
  225.